home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Media 22
/
PC MEDIA CD22.iso
/
share
/
prog
/
patrn_oa
/
patterns.doc
< prev
next >
Wrap
Text File
|
1995-08-29
|
9KB
|
219 lines
╔════════════════════════╗
║ PATTERNS DOCUMENTATION ║
╚════════════════════════╝
┌──────────┐
│ Overview │
└──────────┘
PATTERNS helps you quickly create and edit 8 byte user-defined patterns
to be used in the setfillpattern() function. The program works much like
an icon editor. You click on an editing grid to create/edit a pattern.
A sample of the pattern is displayed and results are updated immediately.
The program also shows the hex code that is being generated.
You can create and edit 24 patterns and save them to a file. The program
features a color bar so you can quickly pick the pattern color. When the
pattern is saved to a file, the program will remember its unique color,
and display it in that color the next time it is loaded.
PATTERNS displays miniatures of all 24 patterns. To edit a pattern, just
double-click on its miniature. The program will also write an annotated
code file for all of the patterns.
THIS PROGRAM IS SHAREWARE, AND TOOK MANY HOURS TO DEVELOP. IF YOU FIND
PATTERNS USEFUL, KINDLY CONTRIBUTE TO THE SHAREWARE SPIRIT.
┌───────────────────────────────┐
│ The setfillpattern() Function │
└───────────────────────────────┘
setfillpattern(char *pattern, int color) sets the current fill pattern to
a user-defined 8x8 pixel pattern. The pixel pattern is determined by the
char *pattern array. This char array consists of 8 bytes. Each byte will
determine a row in the pattern.
Whenever a bit in a pattern's byte is set to 1, the corresponding pixel
is plotted. For example, the following user-defined fill pattern displays
a checkerboard:
char pattern[8] =
{
0xAA, /* 10101010 = █ █ █ █ */
0x55, /* 01010101 = █ █ █ █ */
0xAA, /* 10101010 = █ █ █ █ */
0x55, /* 01010101 = █ █ █ █ */
0xAA, /* 10101010 = █ █ █ █ */
0x55, /* 01010101 = █ █ █ █ */
0xAA, /* 10101010 = █ █ █ █ */
0x55 /* 01010101 = █ █ █ █ */
};
┌────────────────────────────────┐
│ Designing Patterns is Painful! │
└────────────────────────────────┘
As you can see from the above brief explanation, there is nothing obvious
that predicts what pattern will be generated by the pattern[]'s hex bytes.
Without the PATTERNS program, one would have to know the bit sequence that
was desired, and then which hex number it corresponded to. Lots of trial
and error. But this is no longer an issue! PATTERNS takes care of all the
background work and details, leaving you free to use your imagination.
┌────────────────────────────────┐
│ How to Create a Pattern Design │
└────────────────────────────────┘
When PATTERNS first loads, the editing box (displayed as an 8x8 grid)
contains Pattern #1 of Set #1 (which is empty until you save a pattern
to this pattern set). Each row in the box corresponds to a byte in the
char Pattern[8] array, and each cell in a given row represents a bit.
To turn a bit ON, just click on it with the left mouse button. To turn it
OFF, use the right mouse button. It's that simple! Note: you can drag the
mouse across cells to quickly turn them ON or OFF. To change a pattern's
color, click on the color bar. The default color is WHITE.
As you create or edit a pattern, a sample of the pattern is displayed and
will be updated as you make changes. Note also that PATTERNS displays the
actual hex values generated in the Pattern[] array as you make changes.
You can view a full-screen pattern sample by clicking on the Zoom button.
The Clear pushbutton will clear the editing box, letting you start over.
┌───────────────────────┐
│ How to Save a Pattern │
└───────────────────────┘
Saving a pattern is simple. Just click on the Save pushbutton. PATTERNS
will write the Pattern[] array to a binary file called PATTERNS.DAT. This
file is read each time that PATTERNS is loaded, letting you view and edit
patterns at any time in the future.
┌───────────────────────┐
│ How to Edit a Pattern │
└───────────────────────┘
PATTERNS supports 24 user-defined patterns. Miniature samples are shown
in sets of 12. To edit a pattern, just double-click on the miniature. The
program will import the pattern into the editing box. You can always tell
which pattern is currently selected. The frame around the miniature sample
will be highlighted.
You can quickly switch between the 2 sets of 12 patterns by clicking on
the More pushbutton. IMPORTANT!!! BE SURE TO SAVE YOUR WORK BEFORE YOU
IMPORT A NEW PATTERN INTO THE EDITING BOX.
┌───────────────────────┐
│ Generating C/C++ Code │
└───────────────────────┘
Of course, the whole purpose of this program is to create patterns that
you can use in your program. PATTERNS will generate an ASCII file called
PATTERN.CPP that contains the code for the current pattern. Just click on
the C++ pushbutton. Here is a sample of a typical PATTERN.CPP file:
// Code for Pattern #1, pattern set #2
char Pattern[8] = {0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55};
setfillpattern(Pattern, 11);
/* HEX BINARY RESULT
------------------------------------------
Pattern[0] 0xaa 10101010 █ █ █ █
Pattern[1] 0x55 01010101 █ █ █ █
Pattern[2] 0xaa 10101010 █ █ █ █
Pattern[3] 0x55 01010101 █ █ █ █
Pattern[4] 0xaa 10101010 █ █ █ █
Pattern[5] 0x55 01010101 █ █ █ █
Pattern[6] 0xaa 10101010 █ █ █ █
Pattern[7] 0x55 01010101 █ █ █ █
*/
┌─────────────────┐
│ Sample Patterns │
└─────────────────┘
PATTERNS comes with a number of sample patterns. They are located in the
2nd set of 12 patterns. To see or edit them, hit the More pushbutton.
┌──────────────────────┐
│ The Shareware Spirit │
└──────────────────────┘
This program is considered shareware. Please feel free to distribute
this program AS LONG AS IT IS KEPT INTACT. If you find this program
useful, a $7.00 donation would be greatly appreciated. Fill out the
registration form (PATTERNS.REG) and send it to:
Onik Arian
1205 Church Street
Ventura, CA 93001
If you have any questions, comments, or suggestions write me or
contact me via CompuServe 70671,507.
┌────────────────┐
│ PATTERNS Files │
└────────────────┘
PATTERNS.EXE The main program
PATTERNS.DAT A binary file that stores the 24 user-defined patterns
PATTERNS.DOC This documentation file (obviously!)
PATTERNS.REG User registration form
PATTERNS.LST List of all PATTERNS files
PATTERN.CPP The generated code file for a user-defined pattern
PATTERNS REGISTRATION FORM
Name ___________________________________
Address ___________________________________
City ___________________________________
State _________
ZIP _________
CompuServe # _______________________________
Kindly send a check for $7.00, payable to:
Onik Arian
1205 Church Street
Ventura, CA 93001
CompuServe 70671,507
Comments:
_________________________________________________________________
_________________________________________________________________
_________________________________________________________________
_________________________________________________________________
_________________________________________________________________
_________________________________________________________________
NO WARRANTY AS TO THE FITNESS OR USEABILITY OF THIS PROGRAM IS
EITHER EXPRESSED OR IMPLIED. THE USER ASSUMES THE ENTIRE RISK OF
USING THIS PROGRAM.